#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
using namespace std;
int monthd[13] = { 0, 31,28,31,30,31,30,31,31,30,31,30,31 };
class date
{
	int _year;
	int _month;
	int _day;
public:
	date(int year = 2024, int month = 1, int day = 1)
	{
		_year = year;
		_month = month;
		_day = day;
	}
	void changeToYear()
	{
		int flag = 0;
		if (_year % 400 == 0 || (_year % 4 == 0 && _year % 100 != 0))
		{
			flag = 1;
			monthd[2]++;
		}
		while (_day > monthd[_month])
		{
			_day -= monthd[_month];
			_month++;
			if (_month == 13)
			{
				_year++;
				_month = 1;
			}
		}
		if (flag)
			monthd[2]--;
	}
	void Print()

	{
		cout << _year << '-';
		printf("%02d-%02d\n", _month, _day);
	}
};
int main()
{
	int i = 6;
	int year, day;
	while (scanf("%d%d", &year, &day) != EOF)
	{
		class date d(year, 1, day);
		d.changeToYear();
		d.Print();
	}
}